Ext.define('Egitim.view.AnketTanimlamaPanel', {
	extend :'Ext.panel.Panel',
	alias: 'widget.ankettanimlamapanel',
	uses: ['Egitim.model.AnketTanimlama', 'Egitim.view.tanimlar.AnketSoruTipiCombo'],
	layout: 'border',
    defaults: {
        style: {
            padding: '2px'
        }
    },
	items: [{
		xtype: 'form',
		region: 'west',
		width: '60%',
		title: 'Soru',
		items: [{
			xtype: 'textarea',
			name: 'soru',
			fieldLabel: 'Soru Metni'
		}, {
			xtype: 'anketsorutipicombo',
			name: 'soru_tipi',
			listeners: {
				select: function (combo, selected){
					var sel = selected[0];
					combo.up('form').down('#secenekler').setVisible(sel.get('key') === 'S' || sel.get('key') === 'CS');
				}
			}
		}, {
			xtype: 'grid',
			itemId: 'secenekler',
			title: 'Seçenekler',
			hidden: true,
			store: Ext.create('Ext.data.Store', {
			    storeId:'simpsonsStore',
			    fields:['id', 'soru'],
			    data:{'items':[]},
			    proxy: {
			        type: 'memory',
			        reader: {
			            type: 'json',
			            root: 'items'
			        }
			    }
			}),
			columns: [{
				dataIndex: 'secenek',
				text: 'Seçenek',
				flex: 1
			}],
			tbar: [{
				text: 'Ekle'
			}]
		}]
	}, {
		region: 'center',
		xtype: 'grid',
		title: 'Sorular',
		store: Ext.create('Ext.data.Store', {
		    storeId:'simpsonsStore',
		    fields:['id', 'soru'],
		    data:{'items':[
		                   { 'soru': 'Lisa',  "email":"lisa@simpsons.com",  "phone":"555-111-1224"  },
		                   { 'name': 'Bart',  "email":"bart@simpsons.com",  "phone":"555-222-1234" },
		                   { 'name': 'Homer', "email":"home@simpsons.com",  "phone":"555-222-1244"  },
		                   { 'name': 'Marge', "email":"marge@simpsons.com", "phone":"555-222-1254"  }
		               ]},
		    proxy: {
		        type: 'memory',
		        reader: {
		            type: 'json',
		            root: 'items'
		        }
		    }
		}),
		columns: [{
			text: 'Soru',
			dataIndex: 'soru',
			flex: 1
		}, {
			text: 'Soru Tipi',
			dataIndex: 'soru_tipi'
		}]
		
	}]
	
	
	
});